home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Tools & Apps / Misc. Utilities / Installer 3.4 / Examples - Installer 3.4 / InstallDA.r < prev    next >
Encoding:
Text File  |  1992-09-21  |  9.2 KB  |  237 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *    Apple Macintosh Developer Technical Support
  4.  *
  5.  *  Installer 3.2 sample: installing a desk accessory into the appropriate place
  6.  *
  7.  *    File:        InstallDA.r -    Rez Source
  8.  *
  9.  *    by:            Jon Zap
  10.  *  updated for use with Installer 3.4 by: Rich Kubota 9/1/92
  11.  *
  12.  *    Copyright © 1991 Apple Computer, Inc.
  13.  *    All rights reserved.
  14.  *
  15.  *------------------------------------------------------------------------------
  16.  * This sample installs the Key Caps DA into the appropriate place: the system file if we
  17.  * are pre 7.0 or into the Apple Menu Items folder if we are 7.0 or later.
  18.  * It allows for custom installation/removal.
  19.  * We use the gestalt findfolder attributes to determine whether or not the Apple
  20.  * Menu Items folder exists (assuming that there is a correlation between this
  21.  * trap and the folder).  The custom installation makes this difference explicit.
  22.  * Notes of interest:  if we are installing a DA into the system file (pre 7.0)
  23.  * then we merely use an 'inra' that specifies the 'DRVR' resource in a suitcase
  24.  * file by name, the DA's owned resources are handled by the installer
  25.  *----------------------------------------------------------------------------*/
  26.  
  27. #include "Types.r"                    /* for the ICON resource */
  28. #include "InstallerTypes.r"
  29.  
  30. /* You can build and complete the script with the following lines:
  31. # Note: set up floppies with the appropriate names and contents before running scriptcheck
  32. # or set up folders with the same names and contents as the floppies
  33. # put these folders in the same folder as the script or at the root directory of same disk
  34.  
  35.     rez -o "InstallDA" -t 'bbkr' -c 'bbkr' "InstallDA.r"
  36.     setfile -a i "InstallDA"        #mark Inited
  37.     scriptcheck -p "InstallDA"
  38. */
  39.  
  40. /* put a 1 in the creation date field of source 'infs' to have ScriptCheck set date */
  41. #define kScriptCheckSetsDate    0x01
  42.  
  43. /* Definitions for the rules */
  44. #define rule7                1000
  45. #define rule6                1001
  46.  
  47. /* Defines for the file spec atoms.  These are specifications for source and destination files */
  48. #define fsSourceDA7            2000
  49. #define fsSourceDA6            2001
  50. #define fsTargetDA7            2002
  51. #define fsTargetSystem        2003
  52.  
  53. /* This is the name of the source disk */
  54. #define DADisk "DA Disk:"
  55.  
  56. /* where we want to install our DA. */
  57. #define TargetPath7    "special-amnu:"
  58. #define TargetPath6 "special-macs:"
  59.  
  60. /* Definition for the package. */
  61. #define pkTheDA7            3000
  62. #define pkTheDA6            3001
  63.  
  64. /* Definition for the file atom */
  65. #define faDA7                4000
  66.  
  67. /* definition for the resource atom */
  68. #define raDA6                5000
  69.  
  70. /* Definition for the package comment resource */
  71. #define cmtTheDA            6000
  72. #define iconTheDA            7000
  73.  
  74. /* September 4, 1992 is the current release date I put in 'icmt' rsrcs. ScriptCheck will convert */
  75. /* this value to a LongInt seconds value needed by the Installer. */
  76. #define currentReleaseDate    9041992    
  77. #define currentVersion        101     /* Version 1.0.1 goes in the 'icmt' rsrc */
  78.  
  79. /* Gestalt definitions taken from the Gestalt.h file for use in the CheckGestalt clause */
  80. #define gestaltFindFolderAttr 'fold'        /* Folder Mgr attributes */
  81.  
  82.  
  83. /************************** Easy Install Rule resources **********************************/
  84. resource 'infr' (1) {
  85.     format0  {{
  86.         pickFirst,    {rule7, rule6},     /* Select the first rule */
  87.     }};
  88. };
  89.  
  90. /* note the '.' in the first rule is missing in the 2nd rule so we can differentiate*/
  91. resource 'inrl' (rule7) {
  92.     format0 {{
  93.         checkGestalt { gestaltFindFolderAttr, {1} },
  94.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  95.         addUserDescription {"• Key Caps(System 7.0)\n"},
  96.         addPackages {{pkTheDA7}}            /* we're installing the DA */
  97.     }};
  98. };
  99. resource 'inrl' (rule6) {
  100.     format0 {{
  101.         addUserDescription {"Click Install button to install\n"}, /* message to appear in Easy Install screen */
  102.         addUserDescription {"• Key Caps(System 6.0)\n"},    /* message to appear in Easy Install screen */
  103.         addPackages {{pkTheDA6}}            /* we're installing the DA */
  104.     }};
  105. };
  106.  
  107. /***************************** Package Resources ************************************************/
  108. resource 'inpk' (pkTheDA7) {
  109.     format0 {
  110.         showsOnCustom,                     /* Package appears in the Custom Install display */
  111.         removable,                        /* Package can be removed */
  112.         dontForceRestart,                /* not necessary to reboot in this case */
  113.         cmtTheDA,                         /* package's 'icmt' resource id */
  114.         0,                                /* Package size (filled in by ScriptCheck) */
  115.         "DA -> Apple Menu folder (System 7.0)", { /* package name for package that shows on custom */
  116.             'infa', faDA7;
  117.         }
  118.     }
  119. };
  120.  
  121. resource 'inpk' (pkTheDA6) {
  122.     format0 {
  123.         showsOnCustom,                 /* Package appears in the Custom Install display */
  124.         removable,                    /* Package can be removed */
  125.         forceRestart,                /* major mod to system file, force reboot on live install */
  126.         cmtTheDA,                     /* package's 'icmt' resource id */
  127.         0,                            /* Package size (filled in by ScriptCheck) */
  128.         "Key Caps DA -> system file (Pre System 7.0)", { /* package name for package that shows on custom */
  129.             'inra', raDA6;
  130.         }
  131.     }
  132. };
  133.  
  134. /***************************** Comments ************************************************/
  135. resource 'icmt' (cmtTheDA) {
  136.     currentReleaseDate,
  137.     currentVersion,
  138.     iconTheDA,
  139.     "This package installs the Key Caps DA. "
  140. };
  141.  
  142. resource 'ICON' (iconTheDA) {
  143.         $"0430 4000 0A50 A000 0B91 1002 0822 0803"
  144.         $"1224 0405 2028 0209 4010 0111 800C 00A1"
  145.         $"8003 FFC2 7E00 FF04 0100 7F04 0300 1E08"
  146.         $"04E0 000C 08E0 000A 10E0 0009 08C0 0006"
  147.         $"0487 FE04 0288 0104 0188 0084 0088 0044"
  148.         $"0088 0044 0088 00C4 0110 0188 0228 0310"
  149.         $"01C4 04E0 0002 0800 73BF FBEE 4CA2 8A2A"
  150.         $"40AA AAEA 52AA AA24 5EA2 8AEA 73BE FB8E",
  151. };
  152.  
  153.  
  154.  
  155. /********************************************* File Specs *******************************************/
  156. /* Source File Specs */
  157. resource 'infs' (fsSourceDA7) {
  158.     'dfil',                                /* File Type */
  159.     'keyc',                                /* Creator */
  160.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  161.     noSearchForFile,                    /* Do not search the source disk for the file */
  162.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  163.     DADisk"Key Caps 7.0"                /* Path to the file */
  164. };
  165.  
  166. resource 'infs' (fsSourceDA6) {
  167.     'DFIL',                                /* File Type */
  168.     'DMOV',                                /* Creator */
  169.     kScriptCheckSetsDate,                /* ScriptCheck fills in the creation date */
  170.     noSearchForFile,                    /* Do not search the source disk for the file */
  171.     typeCrMustMatch,                    /* file type and creator on source disk must match */
  172.     DADisk"Key Caps 6.0"                    /* Path to the file */
  173. };
  174.  
  175. /* Target File Specs */
  176. resource 'infs' (fsTargetDA7) {
  177.     'dfil',                                /* File Type */
  178.     'keyc',                                /* Creator */
  179.     0,                                    /* creation date not needed for target file specs */
  180.     noSearchForFile,                    /* Do not search the target disk for the file */
  181.     typeCrMustMatch,                    /* not needed for target file specs */
  182.     TargetPath7"Key Caps"                /* destination Path */
  183. };
  184.  
  185. resource 'infs' (fsTargetSystem) {
  186.     'ZSYS',                                /* File Type */
  187.     'MACS',                                /* Creator */
  188.     0,                                    /* creation date not needed for target file specs */
  189.     noSearchForFile,                    /* Do not search the target disk for the file */
  190.     typeCrNeedNotMatch,                    /* not needed for target file specs */
  191.     TargetPath6"System"                    /* destination Path */
  192. };
  193.  
  194. /******************************************** File Atoms ************************************************/
  195. resource 'infa' (faDA7) {
  196.     format0 {
  197.         deleteWhenRemoving,                /* Delete the file if remove (option-custom) is clicked    */
  198.         dontDeleteWhenInstalling,         /* dont need to delete the target before copying new one */
  199.         copy,                             /* Copy the file to the destination */
  200.         leaveAloneIfNewer,                 /* do not Install this version, if newer one exists */
  201.         updateExisting,                 /* replace an existing copy if mine is newer */
  202.         copyIfNewOrUpdate,                /* Copy whether the target file exists or not */
  203.         rsrcFork, dataFork,                /* Copy both forks of the file */
  204.         fsTargetDA7,                    /* TARGET file spec for this file */
  205.         fsSourceDA7,                     /* SOURCE file spec for this file */
  206.         0,                                /* atom size (filled in by ScriptCheck) */
  207.         ""                                /* Atom Description (Installer will use file name) */
  208.     };
  209. };
  210.  
  211. /******************************************** Resource Atoms **********************************************/
  212. resource 'inra' (raDA6) {
  213.     format0 {
  214.         deleteWhenRemoving,                /* Delete the resource if remove (option-custom) is clicked    */
  215.         dontDeleteWhenInstalling,         /* dont need to delete the target before copying new one */
  216.         copy,                             /* Copy rsrc to destination */
  217.         tgtRequired,                     /* Target file need already exist on dest to install */
  218.         updateExisting,                 /* replace any preexisting DA with the same name */
  219.         copyIfNewOrUpdate,                 /* Copy whether or not target rsrc already exists */
  220.         ignoreProtection,                /* Do it even if the target rsrc is protected */
  221.         srcNeedExist,                    /* Rsrc needs to exist on source disk */
  222.         byName,                            /* use the name to find the source and target rsrc */
  223.         nameMustMatch,                    /* this field is ignored if above is byName */
  224.         fsTargetSystem,                    /* Target file spec to install rsrc into */
  225.         fsSourceDA6,                    /* Source file spec where to get rsrc */
  226.         'DRVR',                            /* Resource type */
  227.         0,                                 /* Resource source id */
  228.         0,                                /* Resource target id */
  229.         0,                                /* atom size (filled in by ScriptCheck) */
  230.         "Desk Accessory: Key Caps",        /* Atom description */                            
  231.         "\0x00Key Caps"                    /* Resource name */
  232.     };
  233. };
  234.  
  235.  
  236.  
  237.